package cn.zhuizikejithreeig.com.adapter;



import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import java.util.List;

import cn.zhuizikejithreeig.com.been.BoothBeen;
import cn.zhuizikejithreeig.com.brodcat.BlothClickeView;
import cn.zhuizikejithreeig.com.passenger.R;

public class LaYaListAdapter extends BasicRecycleViewAdapter<BoothBeen>{

    private List<BoothBeen> mShowItems;
    private BlothClickeView mView;

    public LaYaListAdapter(List<BoothBeen> showItems,BlothClickeView view) {
        super(showItems);
        mShowItems = showItems;
        mView = view;
    }
    @Override
    public void convert(BasicViewholder holder, final BoothBeen itm, int position) {
        final TextView textView = (TextView) holder.getView(R.id.textview);
        textView.setText(itm.getName());

        if (itm.getCencent()){
            textView.setTextColor(Color.BLUE);
        }else {
            textView.setTextColor(Color.BLACK);
        }
        holder.getView(R.id.parent).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                textView.setTextColor(Color.BLUE);
                itm.setCencent(true);
                mView.sendUri(itm.getAddress());
                //再次刷新
                LaYaListAdapter.this.notifyDataSetChanged();
            }
        });
    }

    @Override
    public int getSuccessFullView(int viewType) {
        return R.layout.lanya;
    }


}
